<!--{include file='public/top' /}-->

<body>
    
<div class="x-body">
    <div class="layui-row clear pagesa" style="margin-bottom: 40px;">
        <p class="fl">>基本设置</p>
    </div>
    <form class="layui-form" autocomplete="off">

        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>网站名称
            </label>
            <div class="layui-input-block">
                <input type="hidden" name="data[0][id]" value="<!--{$list[0]['id']}-->">
                <input type="hidden" name="data[0][title]" value="<!--{$list[0]['title']}-->">
                <input type="text" name="data[0][value]" value="<!--{$list[0]['value']}-->" lay-verify="required" class="layui-input">
                <input type="hidden" name="data[0][type]" value="<!--{$list[0]['type']}-->">
                <input type="hidden" name="data[0][uptime]" value="<!--{:time()}-->">
            </div>
        </div>
        
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>首页网址
            </label>
            <div class="layui-input-block">
                <input type="hidden" name="data[1][id]" value="<!--{$list[1]['id']}-->">
                <input type="hidden" name="data[1][title]" value="<!--{$list[1]['title']}-->">
                <input type="text" name="data[1][value]" value="<!--{$list[1]['value']}-->" lay-verify="required" class="layui-input">
                <input type="hidden" name="data[1][type]" value="<!--{$list[1]['type']}-->">
                <input type="hidden" name="data[1][uptime]" value="<!--{:time()}-->">
            </div>
        </div>
        
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>公司邮箱
            </label>
            <div class="layui-input-block">
                <input type="hidden" name="data[2][id]" value="<!--{$list[2]['id']}-->">
                <input type="hidden" name="data[2][title]" value="<!--{$list[2]['title']}-->">
                <input type="text" name="data[2][value]" value="<!--{$list[2]['value']}-->" lay-verify="required" class="layui-input">
                <input type="hidden" name="data[2][type]" value="<!--{$list[2]['type']}-->">
                <input type="hidden" name="data[2][uptime]" value="<!--{:time()}-->">
            </div>
        </div>
        
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>公司电话
            </label>
            <div class="layui-input-block">
                <input type="hidden" name="data[3][id]" value="<!--{$list[3]['id']}-->">
                <input type="hidden" name="data[3][title]" value="<!--{$list[3]['title']}-->">
                <input type="text" name="data[3][value]" value="<!--{$list[3]['value']}-->" lay-verify="required" class="layui-input">
                <input type="hidden" name="data[3][type]" value="<!--{$list[3]['type']}-->">
                <input type="hidden" name="data[3][uptime]" value="<!--{:time()}-->">
            </div>
        </div>
        
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>公司地址
            </label>
            <div class="layui-input-block">
                <input type="hidden" name="data[4][id]" value="<!--{$list[4]['id']}-->">
                <input type="hidden" name="data[4][title]" value="<!--{$list[4]['title']}-->">
                <input type="text" name="data[4][value]" value="<!--{$list[4]['value']}-->" lay-verify="required" class="layui-input">
                <input type="hidden" name="data[4][type]" value="<!--{$list[4]['type']}-->">
                <input type="hidden" name="data[4][uptime]" value="<!--{:time()}-->">
            </div>
        </div>
        
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>版权信息
            </label>
            <div class="layui-input-block">
                <input type="hidden" name="data[5][id]" value="<!--{$list[5]['id']}-->">
                <input type="hidden" name="data[5][title]" value="<!--{$list[5]['title']}-->">
                <input type="text" name="data[5][value]" value="<!--{$list[5]['value']}-->" lay-verify="required" class="layui-input">
                <input type="hidden" name="data[5][type]" value="<!--{$list[5]['type']}-->">
                <input type="hidden" name="data[5][uptime]" value="<!--{:time()}-->">
            </div>
        </div>
        
        <div class="layui-form-item">
                <label class="layui-form-label" style="margin: 20px 0 0 0;"> <span class="x-red"></span>默认BANNER</label>
                <span id="delmultimg">
                    <!--{volist name='att' id='v'}-->
                    <span><img src="<!--{$v.path}-->" width="120"><!--i class="layui-icon layui-icon-delete" style="display: inline-block"></i--><input type="hidden" name="multimg[]" value="<!--{$v.id}-->"></span>
                    <!--{/volist}-->
                </span>
                <label for="multimg"><img style="width: 120px;margin: 0 10px 0 0;cursor:pointer;" src="/static/admin/img/addLogo_box.png"><span>请按照要求的尺寸添加</span> </label>
                <button type="button" class="layui-btn layui-btn-small layui-hide" id="multimg"> <i class="layui-icon">&#xe67c;</i>上传图片 </button>
        </div>
 
        <div class="layui-form-item">
            <button type="button"  class="layui-btn layui-btn-normal" lay-filter="edit" lay-submit="" style="margin-left: 100px">提交</button>
        </div>
    </form>
</div>
<script>

    var editurl = '/admin/config/index.html';
    var uploadurl = '/admin/config/upload.html';
    //编辑器
    var ue = UE.getEditor('editor');
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //自定义验证规则
        form.verify({
            pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,repass: function(value){
                if($('#L_pass').val()!=$('#L_repass').val()){
                    return '两次密码不一致';
                }
            }
        });
        //监听提交
        form.on('submit(edit)', function(data){
            $.post(editurl, data.field,function(res) {
                if(res.code===200){
                    layer.msg(res.msg, {
                        time: 1000, //不自动关闭
                        icon:6,
                        end:function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        }
                    });
                    return false;
                }else {
                    layer.msg(res.msg)
                }


            });

        });
    });
layui.use(['upload','layer'], function(){
    var upload = layui.upload;
    var uploadInst = upload.render({
            elem: '#multimg',
            url: uploadurl,
            auto: false,
            accept: 'images',
            acceptMime: 'image/*',
            size : '100',
            multiple: false,
            choose: function(o){
                layer.prompt({
                    formType: 3,
                    value: '附件',
                    title: '请输入附件描述'
                }, function(value, index, elem){
                    uploadInst.config.data = {
                        subject:value
                    }
                    layer.close(index);
                    uploadInst.upload();
                });
            },
            done: function(res){
                var  option = '<span><img src="'+res.data.path+'" width="120"><!--i class="layui-icon layui-icon-delete" style="display: inline-block"></i--><input type="hidden" name="multimg[]" value="'+res.data.id+'"></span>';
                $('#delmultimg').append(option);
            },
            error: function(){
                
            }
            
        });
    });
</script>
</body>

</html>